<table border="1">
    Détail des frais forfaits
    <tr>
        <th>IdVisiteur</th>
        <th>Mois</th>
        <th>ETP</th>
        <th>KM</th>
        <th>NUI</th>
        <th>REP</th>
    </tr>

    <?php
    $visiteurcourant = $this->lesStats[0]['idVisiteur'];
    $ETPtotal = 0;
    $KMtotal = 0;
    $NUItotal = 0;
    $REPtotal = 0;

    for ($i = 0; $i < sizeof($this->lesStats); $i++) {
        if ($this->lesStats[$i]["idVisiteur"] == $visiteurcourant) {
            $ETPtotal = $ETPtotal + $this->lesStats[$i]['ETP'];
            $KMtotal = $KMtotal + $this->lesStats[$i]['KM'];
            $NUItotal = $NUItotal + $this->lesStats[$i]['NUI'];
            $REPtotal = $REPtotal + $this->lesStats[$i]['REP'];
        } else {
            echo "<tr style='background-color: #FEF60D;'>
            <td>
            Visiteur : " . $visiteurcourant
            . "&nbsp ETP : " . $ETPtotal .
            "&nbsp KM : " . $KMtotal . 
            "&nbsp NUI : " . $NUItotal .
            "&nbsp REP : " . $REPtotal ."
                    </td>
            </tr>";
            $ETPtotal = $this->lesStats[$i]['ETP'];
            $KMtotal = $this->lesStats[$i]['KM'];
            $NUItotal = $this->lesStats[$i]['NUI'];
            $REPtotal = $this->lesStats[$i]['REP'];
        }

        echo "<tr>
        <td>" . $this->lesStats[$i]['idVisiteur'] . "</td>
            <td>" . $this->lesStats[$i]['mois'] . "</td>
                <td>" . $this->lesStats[$i]['ETP'] . "</td>
                    <td>" . $this->lesStats[$i]['KM'] . "</td>
                        <td>" . $this->lesStats[$i]['NUI'] . "</td>
                    <td>" . $this->lesStats[$i]['REP'] . "</td>
                       
    </tr>";

        $visiteurcourant = $this->lesStats[$i]["idVisiteur"];
    }
    echo "<tr style='background-color: #FEF60D;'>
            <td>
            Visiteur : " . $visiteurcourant
            . "&nbsp ETP : " . $ETPtotal .
            "&nbsp KM : " . $KMtotal . 
            "&nbsp NUI : " . $NUItotal .
            "&nbsp REP : " . $REPtotal ."
                    </td>
            </tr>";
    ?>

</table>